﻿using System;
using System.Collections.Generic;

namespace thinger.VisitionDAL
{
	public enum plcStep
	{
		请求取料,
		取料,
		取料完成,
		检测A,
		检测A中,
		检测B,
		检测B中,
		进入打码A,
		打码A执行,
		打码A完成,
		进入打码B,
		打码B执行,
		打码B完成,
		读码A,
		读码B,
		下料,
		下料完成,
		流程完成
	}

	public enum Step
	{
		运行到安全位,
		取料拍照,
		放料拍照,
		取料定位,
		取料,
		下相机定位,
		下相机拍照,
		放料定位,
		放料,
	}

	public enum robot_shang_Step
	{
		发送拍照位,
		抓取定位纠偏,
		放料,
		放料完成
	}

	public enum robot_xia_Step
	{
		取料点,
		进入下料,
		下料完成
	}

	public class OrderData
	{
		public string Index { get; set; }

		public string Code { get; set; }
		public string path { get; set; }
		public string LitCode { get; set; }
		public string Line { get; set; }
		public string IsOk { get; set; }
		public bool IsPass { get; set; }
		public int BadMark { get; set; }
		public bool IsBaoFei { get; set; }
		public double codex;
		public double codey;
		public double coder;
		public List<cell_info> mapInfos = new List<cell_info>();

		public int apasscount { get; set; }
		public int bpasscount { get; set; }
		public int agoodcount { get; set; }
		public int bgoodcount { get; set; }
		public int adefectcount { get; set; }
		public int bdefectcount { get; set; }
		public int acheckcount { get; set; }
		public int bcheckcount { get; set; }
	}

	public class product
	{
		public string lotid { get; set; }
		public int state { get; set; }
		public int total { get; set; }
		public int ok { get; set; }
		public int ng { get; set; }
		public string workmode { get; set; }
		public int ispass { get; set; }
		public string img { get; set; }
		public string time { get; set; }
		public int okA { get; set; }
		public int ngA { get; set; }
		public int okB { get; set; }
		public int ngB { get; set; }

		public int aones { get; set; }
		public int atwos { get; set; }
		public int bones { get; set; }
		public int btwos { get; set; }
	}

	public class ProductDetail
	{
		public string lotid { get; set; }
		public int state { get; set; }
		public int total { get; set; }
		public int ok { get; set; }
		public int ng { get; set; }
		public string workmode { get; set; }
		public int ispass { get; set; }
		public string img { get; set; }
		public string time { get; set; }
		public int okA { get; set; }
		public int ngA { get; set; }
		public int okB { get; set; }
		public int ngB { get; set; }

		public int aones { get; set; }
		public int atwos { get; set; }
		public int bones { get; set; }
		public int btwos { get; set; }

		/// <summary>
		/// 产品型号
		/// </summary>
		public string modelName { get; set; }

		/// <summary>
		/// 客户编码
		/// </summary>
		public string userCode { get; set; }

		/// <summary>
		/// 打码批次
		/// </summary>
		public string damaPici { get; set; }

		/// <summary>
		/// 流水
		/// </summary>
		public string liuShui { get; set; }

		/// <summary>
		/// 打码版本
		/// </summary>
		public string damaVer { get; set; }
	}

	public class Result
	{
		public int OKNumber { get; set; }

		public int NGNumber { get; set; }
	}

	public class cell_info
	{
		public int id { get; set; }
		public string lotid { get; set; }
		public int lineid { get; set; }
		public int cellid { get; set; }
		public string img { get; set; }
		public string imgcenter { get; set; }//带中心点的图片
		public int state { get; set; }
		public string time { get; set; }
		public string workmode { get; set; }
		public string facename { get; set; }

		/// <summary>
		/// 报点列表
		/// </summary>
		public string rectErrs { get; set; } = string.Empty;
	}

	/// <summary>
	/// cell 信息明细
	/// </summary>
	public class CellInfoDetail
	{
		public int id { get; set; }
		public string lotid { get; set; }
		public int lineid { get; set; }
		public int cellid { get; set; }
		public string img { get; set; }
		public string imgcenter { get; set; }//带中心点的图片
		public int state { get; set; }
		public string time { get; set; }
		public string workmode { get; set; }
		public string facename { get; set; }

		/// <summary>
		/// 产品型号
		/// </summary>
		public string modelName { get; set; }

		/// <summary>
		/// 客户编码
		/// </summary>
		public string userCode { get; set; }

		/// <summary>
		/// 打码批次
		/// </summary>
		public string damaPici { get; set; }

		/// <summary>
		/// 流水
		/// </summary>
		public string liuShui { get; set; }

		/// <summary>
		/// 打码版本
		/// </summary>
		public string damaVer { get; set; }

		public string rectErrs { get; set; }
	}

	public enum plcWarn
	{
		机器人通讯断开报警,
		急停报警,
		料盘上料升降报警,
		料盘OK料升降报警,
		萃盘搬运轴报警,
		料搬运轴1报警,
		料翻转轴1报警,
		料搬运轴2报警,
		料翻转轴2报警,
		安全门报警,
		萃盘搬运升降气缸报警,
		移栽搬运1升降气缸报警,
		移栽搬运2升降气缸报警,
		萃盘搬运真空吸报警,
		机器人报警,
		机器人真空吸报警,
		搬运1检测产品报废信号,
		搬运2检测产品报废信号,
		NG料仓满料信号
	}

	public enum robotUpStep
	{
		允许机器人放料,
		机器人放料完成,
		请求机器人下料,
		机器人下料完成,
		T面检测请求,
		B面检测请求,
		等待T面检测完成信号,
		等待B面检测完成信号,
		T面打码请求,
		B面打码请求,
		等待T面打码完成信号,
		等待B面打码完成信号,
		T面请求扫码,
		B面请求扫码,
		等待T面扫码完成信号,
		等待B面扫码完成信号,
	}

	public enum robotDownStep
	{
		允许机器人放料,
		机器人放料完成,
		请求机器人下料,
		机器人下料完成,
		T面检测请求,
		B面检测请求,
		等待T面检测完成信号,
		等待B面检测完成信号,
		T面打码请求,
		B面打码请求,
		等待T面打码完成信号,
		等待B面打码完成信号,
		T面请求扫码,
		B面请求扫码,
		等待T面扫码完成信号,
		等待B面扫码完成信号,
	}

	/// <summary>
	/// 不良项柏拉图数据
	/// </summary>
	public class PlatoChartData
	{
		public string lotid { get; set; }
		public string cellid { get; set; }

		public string facemode { get; set; }

		public DateTime createtime { get; set; }

		public string damaPici { get; set; }

		public string rectErrs { get; set; }

		public string day
		{
			get
			{
				if (createtime != DateTime.MinValue)
				{
					return createtime.ToString("yyyy-MM-dd");
				}
				return "";
			}
		}

		public string month
		{
			get
			{
				if (createtime != DateTime.MinValue)
				{
					return createtime.ToString("yyyy-MM");
				}
				return "";
			}
		}

		public int quarter
		{
			get
			{
				if (createtime != DateTime.MinValue)
				{
					int _quarter = (createtime.Month - 1) / 3 + 1;

					return _quarter;
				}
				return 0;
			}
		}

		public string year
		{
			get
			{
				if (createtime != DateTime.MinValue)
				{
					return createtime.ToString("yyyy");
				}
				return "";
			}
		}
	}
}